<template>
  <div class="shishi">
    <h2>平台实时交易情况</h2>

    <div id="mai" style="width: 100%; height: 400px"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  mounted() {
    echartc();
    function echartc() {
      var chartDom = document.getElementById("mai");
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        title: {
          text: "当日成交金额",
          left: "1%",
          textStyle: {
            color: "#666",
            fontWeight: "normal",
            fontSize: "18px",
          },
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          data: ["Email", "Union Ads", "Video Ads", "Direct", "Search Engine"],
          right: "10px",
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: ["9:00", "12:00", "15:00", "16:00", "18:00", "22:00", "24:00"],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            name: "Email",
            type: "line",
            stack: "Total",
            data: [120, 132, 101, 134, 90, 230, 210],
          },
          {
            name: "Union Ads",
            type: "line",
            stack: "Total",
            data: [220, 182, 191, 234, 290, 330, 310],
          },
          {
            name: "Video Ads",
            type: "line",
            stack: "Total",
            data: [150, 232, 201, 154, 190, 330, 410],
          },
          {
            name: "Direct",
            type: "line",
            stack: "Total",
            data: [320, 332, 301, 334, 390, 330, 320],
          },
          {
            name: "Search Engine",
            type: "line",
            stack: "Total",
            data: [820, 932, 901, 934, 1290, 1330, 1320],
          },
        ],
      };

      option && myChart.setOption(option);
    }
  },
};
</script>

<style scoped>
.shishi {
  padding-left: 6%;
  margin-top: 20px;
}
h2 {
  width: 70%;
  font-size: 16px;
  height: 24px;
  line-height: 24px;
  padding-bottom: 20px;
  margin-bottom: 20px;
}
</style>